package com.xjscrm.console.web.wwCustomer;

import com.xjscrm.console.param.BaseDto;
import com.xjscrm.console.param.wwCustomer.CheckRepeatWwCustomerDto;
import com.xjscrm.console.param.wwCustomer.DeleRepeatWwCustomerDto;
import com.xjscrm.console.param.wwCustomer.RepeatWwCustomerQuery;
import com.xjscrm.console.service.customer.wwCustomer.WwCustomerDistinctService;
import com.xjscrm.console.vo.RepeatWwCustomerVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "客户去重管理", tags = "客户去重管理")
@RestController
@RequestMapping(value = "/wwCustomer/distinct")
public class WwCustomerDistinctController {

    @Autowired
    private WwCustomerDistinctService wwCustomerDistinctService;

    @ApiOperation(value = "检测重复的客户", notes = "检测重复的客户",response = Boolean.class)
    @PostMapping(value ="/checkRepeatWwCustomer" )
    public Object checkRepeatWwCustomer(@RequestBody CheckRepeatWwCustomerDto checkRepeatWwCustomerDto)throws Exception{
        wwCustomerDistinctService.checkRepeatWwCustomer(checkRepeatWwCustomerDto);
        return true;
    }

    @ApiOperation(value = "取消检测重复的客户", notes = "取消检测重复的客户",response = Boolean.class)
    @PostMapping(value ="/breakCheck" )
    public Object breakCheck(@RequestBody BaseDto baseDto)throws Exception{
        wwCustomerDistinctService.breakCheck(baseDto);
        return true;
    }

    @ApiOperation(value = "获取检测状态", notes = "获取检测状态",response = Boolean.class)
    @PostMapping(value ="/getCheckStatus" )
    public Object getCheckStatus(@RequestBody BaseDto baseDto)throws Exception{
        return wwCustomerDistinctService.getCheckStatus(baseDto);

    }

    @ApiOperation(value = "获取检测结果", notes = "获取检测结果",response = RepeatWwCustomerVo.class)
    @PostMapping(value ="/getCheckResult" )
    public Object getCheckResult(@RequestBody RepeatWwCustomerQuery CheckResultQuery)throws Exception{
       return   wwCustomerDistinctService.getCheckResult(CheckResultQuery);
    }

    @ApiOperation(value = "去重客户", notes = "去重客户",response = Integer.class)
    @PostMapping(value ="/deleRepeatWwCustomer" )
    public Object deleRepeatWwCustomer(@RequestBody DeleRepeatWwCustomerDto deleRepeatWwCustomerDto)throws Exception{
        return wwCustomerDistinctService.deleRepeatWwCustomer(deleRepeatWwCustomerDto);

    }
}
